package lt.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lt.web.mapper.AppCategoryMapper;
import lt.web.pojo.AppCategory;
import lt.web.service.AppCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppCategoryServiceImpl extends ServiceImpl<AppCategoryMapper,AppCategory> implements AppCategoryService {
    @Autowired
    AppCategoryMapper appCategoryMapper;

    @Override
    public List<AppCategory> getByCategorynameAppCategoryList(Integer parentId) {
        QueryWrapper queryWrapper =new QueryWrapper();
        if(parentId==null){
            queryWrapper.isNull(true,"parentId");
        }
        if(parentId!=null){
            queryWrapper.eq("parentId",parentId);
        }
        return appCategoryMapper.selectList(queryWrapper);
    }
}
